<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.model.Admin"%>
<%@ page import="com.control.AdminControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
	</head>
	<body>
		<%
			request.setCharacterEncoding("UTF-8");
			String admin_num = request.getParameter("number");
			String admin_pwd = request.getParameter("password");
			String admin_name = request.getParameter("name");
			String admin_sex = request.getParameter("sex");
			String admin_tel = request.getParameter("tel");
			int admin_building_id = Integer.parseInt(request
					.getParameter("building"));
			int admin_id = Integer.parseInt(request.getParameter("id"));
			Admin a = new Admin();
			AdminControl ac = new AdminControl();
			a.setAdmin_num(admin_num);
			a.setAdmin_pwd(admin_pwd);
			a.setAdmin_name(admin_name);
			a.setAdmin_sex(admin_sex);
			a.setAdmin_tel(admin_tel);
			a.setAdmin_id(admin_id);
			a.setAdmin_building_id(admin_building_id);
			if (ac.updateAdmin(a)) {
		%>
				<script>
					if(window.confirm("确认修改？"))
						window.location.href="adminInfo_show.jsp";
					else
						window.location.href = "adminInfo_change.jsp?id=<%=admin_id%>";
				</script>
		<%
			} else {
		%>
				<script>
					alert("修改失败！");
					window.location.href="adminInfo_change.jsp?id=<%=admin_id%>";
				</script>
		<%}%>
	</body>
</html>